/*
 * @Author: weikang
 * @Description:
 * @Date: 2024-02-08 21:25:07
 * @LastEditTime: 2024-02-24 12:12:29
 * @FilePath: \env-manager-pc\src\api\modules\assets.ts
 */

import api from '../index'
import type { EntListRes, QueryFilter, RowListRes } from './types/ent'
import type { orderForm, orderInfo } from './types/assets'
import type { InWarehouseForm } from '@/views/assets/warehouse/page'
import type { UseForm } from '@/views/assets/get/page'
import type { InstallForm } from '@/views/assets/install/page'
import type { InvalidForm } from '@/views/assets/demolish/page'
import type { SellForm } from '@/views/assets/sales/page'

export default {
  // 合同列表
  GetOrderForms: (data: QueryFilter) => api<EntListRes<orderInfo>>({
    url: `/Obj/Asset/GetOrderForms`,
    method: 'post',
    data,
  }),
  // 新增订单
  AddOrderForm: (data: { orderForm: orderForm }) => api<orderForm>({
    url: `/Obj/Asset/AddOrderForm`,
    method: 'post',
    data,
  }),
  // 修改订单
  UpdateOrderForm: (data: { orderFormObjID: string, orderForm: orderForm }) => api<orderForm>({
    url: `/Obj/Asset/UpdateOrderForm`,
    method: 'post',
    data,
  }),
  // 删除订单
  DeleteOrderForm: (data: { orderFormObjID: string }) => api<orderForm>({
    url: `/Obj/Asset/DeleteOrderForm`,
    method: 'post',
    data,
  }),
  // 订单资产号
  GetOrderFormAssetCodes: (data: { orderFormObjID: string }) => api<any>({
    url: `/Obj/Asset/GetOrderFormAssetCodes`,
    method: 'post',
    data,
  }),
  // 生产厂家
  GetAssetFactorys: () => api({
    url: `/Obj/Asset/GetAssetFactorys`,
    method: 'post',
  }),
  // 类型
  GetAssetModelClassifys: () => api({
    url: `/Obj/Asset/GetAssetModelClassifys`,
    method: 'post',
  }),
  // 产品
  GetAssetModels: () => api({
    url: `/Obj/Asset/GetAssetModels`,
    method: 'post',
  }),
  // 资产状态
  GetStateTypes: () => api({
    url: `/Obj/Asset/GetStateTypes`,
    method: 'post',
  }),
  // 资产列表
  GetAssets: (data: QueryFilter) => api<RowListRes<orderForm>>({
    url: `/Obj/Asset/GetAssets`,
    method: 'post',
    data,
  }),
  // 资产变更
  GetAssetChanges: (data: { assetObjIDs: string[] }) => api<any>({
    url: `/Obj/Asset/GetAssetChanges`,
    method: 'post',
    data,
  }),
  // 资产入库
  InWarehouse: (data: InWarehouseForm) => api<any>({
    url: `/Obj/Asset/Change/InWarehouse`,
    method: 'post',
    data,
  }),
  // 资产领用
  ChangeUse: (data: UseForm) => api<any>({
    url: `/Obj/Asset/Change/Use`,
    method: 'post',
    data,
  }),
  // 资产安装
  ChangeInstall: (data: InstallForm) => api<any>({
    url: `/Obj/Asset/Change/Install`,
    method: 'post',
    data,
  }),
  // 资产拆除
  ChangeInvalid: (data: InvalidForm) => api<any>({
    url: `/Obj/Asset/Change/Invalid`,
    method: 'post',
    data,
  }),
  // 资产销售
  ChangeSell: (data: SellForm) => api<any>({
    url: `/Obj/Asset/Change/Sell`,
    method: 'post',
    data,
  }),
}
